<?php
/*
	我的下线
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
cfc('core')->checklogin();
$zhaoshangid=$this->getcolumn('list',array('mid'=>$_SESSION['uid']),'id');
if($_RQ['op']=='main'){
	$return['setting']=$this->plugin_setting('page');
	$return['member']=cfc('core')->member_show($_SESSION['uid']);
	$params=array('uniacid'=>$_SESSION['uniacid'],'zhaoshangid'=>$zhaoshangid);
	$return['member']['merchnum']=pdo_count('jy_supplier_user',$params,'id');
	$return['params']=array('page'=>1);
	$return['psize']=20;
	$return['list']=array();
	set_html('title',$return['setting']['tmydown']?:'我的商户');
	exi($return);
}
if($_RQ['op']=='list'){
	$params=array('uniacid'=>$_SESSION['uniacid'],'zhaoshangid'=>$zhaoshangid);
	$psize=20;
	$pindex=intval($_RQ['page'])?:1;
	$parameter=array(
		'params'=>$params,
		'limit'=>array($pindex,$psize),
	);
	$list=pdo_getlist('jy_supplier_user',$parameter);
	if(!$list){
		exi('none');
	}
	foreach($list as &$item){
		$item['member']=cfc('core')->member_show($item['mid']);
		$item['jointime']=date('Y-m-d H:i:s',$item['jointime']);
		$item['moneycount']=pdo_getsum('jy_weishop_order_goods',array('merchid'=>$item['id']),'total_price');
		$item['ordercount']=pdo_count('jy_weishop_order_goods',array('merchid'=>$item['id']),'id');
	}
	exi($list);
}
?>